package com.bw.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.bw.annotation.Log;
import com.bw.config.Result;
import com.bw.domain.JobLog;
import com.bw.domain.OperLog;
import com.bw.enums.BusinessType;
import com.bw.service.JobLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author Big-Hang
 * @data 2023/8/17
 */
@RequestMapping("jobLog")
@RestController
public class JobLogController {

    @Autowired
    JobLogService   jobLogService;

    @RequestMapping("jobList")
    public Result list(Page page){
        Page page1 = jobLogService.page(page);
        return Result.ok(page1);
    }

    @Log(title = "删除任务日志", businessType = BusinessType.DELETE)
    @RequestMapping("delete")
    public Result delete(Integer iss) {
        jobLogService.removeById(iss);
        return Result.ok();
    }


    @Log(title ="任务日志信息修改", businessType = BusinessType.UPDATE)
    @RequestMapping("update")
    public Result update(@RequestBody JobLog jobLog){
        boolean b = jobLogService.updateById(jobLog);
        return b?Result.ok():Result.fail("修改失败");
    }



}
